#/usr/bin/env python
import SocketServer
from time import ctime

HOST = ''
PORT = 8888
addr = (HOST,PORT)

class Myserver(SocketServer.StreamRequestHandler):
    def handle(self):
        print 'got connection from', self.client_address
        #self.wfile.write('connection %s:%s at %s succeed!'%(HOST,PORT,ctime()))
        while True:
            data = self.request.recv(1024)
            if not data:
                continue
            else:
                print data

            self.request.send(data)

server = SocketServer.ThreadingTCPServer(addr,Myserver) 

server.serve_forever()


